package cn.exrick.xboot.message

import cn.exrick.xboot.core.common.vo.Result
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import javax.servlet.http.HttpServletRequest

@RestController
@RequestMapping("/xboot/message")
@Api(tags = ["发送短信接口"])
open class MessageController {


    @Autowired
    private lateinit var iSendMessageService: ISendMessageService


    @PostMapping("/sendRegisterSmsCode")
    @ApiOperation("发送企业注册短信验证码")
    fun sendRegisterSmsCode(mobile: String, request: HttpServletRequest) : Result<Any?>? {

        return iSendMessageService.sendSms(mobile, "SMS_181866038", request)
    }


    @PostMapping("/sendAppRegisterSmsCode")
    @ApiOperation("发送app注册短信验证码")
    fun sendAppRegisterSmsCode(mobile: String, request: HttpServletRequest) : Result<Any?>? {

        return iSendMessageService.sendSms(mobile, "SMS_202835051", request)
    }

    @PostMapping("/sendForgetPasswordSmsCode")
    @ApiOperation("发送忘记密码短信验证码")
    fun sendForgetPasswordSmsCode(mobile: String, request: HttpServletRequest) : Result<Any?>? {

        return iSendMessageService.sendSms(mobile, "SMS_202835043", request)
    }

}